Public Function JMTestCanWrite(argProgramName, argPath As String, argSize As Long, argError As String) As Integer
JMTestCanWrite = False
On Error Resume Next
If (JMTestDriveRemoveable(argPath) = False) Then
If (JMTestDriveIsReady(argPath) = False) Then
argError = "Drive is Not Ready."
Exit Function
End If
If (argSize >= (JMTestDriveAvailableSpace(argPath) - 1024)) Then
argError = "Not enough space on Drive."
Exit Function
End If
JMTestCanWrite = True
Exit Function
Else
Do
If (JMTestDriveIsReady(argPath) = False) Then
Select Case MsgBox("Drive is Not Ready." & vbCrLf & vbCrLf & "Do you want to Continue?", vbDefaultButton2 + vbYesNo + vbQuestion, argProgramName)
Case vbYes
Case Else
argError = ""
Exit Function
End Select
End If
If (argSize >= (JMTestDriveAvailableSpace(argPath) - 1024)) Then
Select Case MsgBox("Not enough space on Drive - Change to a New Disc." & vbCrLf & vbCrLf & "Do you want to Continue?", vbDefaultButton2 + vbYesNo + vbQuestion, argProgramName)
Case vbYes
Case Else
argError = ""
Exit Function
End Select
Else
JMTestCanWrite = True
Exit Function
End If
Loop
End If
End Function
Public Function JMTestDriveAvailableSpace(argPath As String) As Long
Dim wrkFileObject As Object
Dim wrkDrives
Dim wrkDrive As Object
JMTestDriveAvailableSpace = 0
On Error Resume Next
Set wrkFileObject = CreateObject("Scripting.FileSystemObject")
Set wrkDrives = wrkFileObject.Drives
For Each wrkDrive In wrkDrives
If (StrComp(wrkDrive.DriveLetter, Left$(argPath, 1), 1) = 0) Then